﻿@model IEnumerable<Cadcam7Moddel.Model.NgonNgu>

@foreach(var lang in Model)
{
    if (Request.Cookies["_culture"]["lang"] == lang.Ma)
    {
         <img style="width:30px; height:23px" src="@Url.Content("~"+lang.HinhAnh)" />
    }
    else
    {
    <a href="#" class="langchange" title="@lang.TenNgonNgu" rel="@lang.Ma"><img style="width:30px; height:23px" src="@Url.Content("~"+lang.HinhAnh)" /></a>    
    }   
}
<script>
    $(document).ready(function () {
        $(".langchange").click(function () {
            var lang = $(this).attr("rel");
            var itemid = $("#itemid").val();
            $.ajax({
                type: "post", url: "@Url.Action("AjaxLang","Language")", data: { lang: lang, itemid:itemid}, dataType: "json", success: function (res) {
                    if (res.url != "") {
                        window.location = res.url;
                    }
                    else {
                        window.location = "/";
                    }
                    
                }
            });
            return false;
        });
    });
</script>